export interface User {
  id: number;
  username: string;
  email: string;
  roles: ('AppUser' | 'PlatformUser' | 'Administrator' | 'SystemAdministrator')[];
  tenantId: number;
  created_at: string;
  updated_at: string;
}

export interface Tenant {
  id: number;
  name: string;
  description?: string;
  tenantKey: string;
  isActive: boolean;
  createdAt: string;
  updatedAt: string;
}

export interface Team {
  id: number;
  name: string;
  description?: string;
  team_admins: number[];
  team_members: number[];
  created_at: string;
  updated_at: string;
}

export interface Document {
  id: number;
  filename: string;
  file_path: string;
  file_size: number;
  file_type: string;
  chunking_mode: 'fixed' | 'semantic' | 'paragraph' | 'none';
  chunk_size?: number;
  chunk_overlap?: number;
  uploaded_at: string;
  updated_at: string;
  knowledge_base_id: number;
}

export interface KnowledgeBase {
  id: number;
  name: string;
  description?: string;
  is_public?: boolean;
  kb_admins: number[];
  team_access: number[];
  documents: number[];
  created_at: string;
  updated_at: string;
}

export interface PluginParameter {
  name: string;
  type: 'string' | 'number' | 'boolean' | 'object';
  required?: boolean;
  description?: string;
}

export interface Plugin {
  id: number;
  name: string;
  description?: string;
  pluginType: 'MCP' | 'OpenAPI';
  authMethod: 'none' | 'bearer' | 'api_key' | 'basic';
  endpoint?: string;
  parameterDefinitions?: PluginParameter[];
  created_at: string;
  updated_at: string;
}

export interface AgentPredefinedPrompt {
  name: string;
  description?: string;
  content: string;
}

export interface AgentPluginConfig {
  pluginId: number;
  authToken?: string;
  endpoint?: string;
  parameterValues?: Record<string, any>;
}

export interface Agent {
  id: number;
  name: string;
  category?: string;
  icon?: string;
  description?: string;
  system_prompt?: string;
  welcomeMessage?: string;
  predefinedPrompts?: AgentPredefinedPrompt[];
  model_provider: string;
  model_name: string;
  ve_admins: number[];
  team_access: number[];
  knowledge_bases: number[];
  plugins: number[];
  plugin_configurations?: AgentPluginConfig[];
  created_at: string;
  updated_at: string;
}

export interface TokenUsage {
  id: number;
  user_id: number;
  agent_id: number;
  tokens_used: number;
  cost: number;
  created_at: string;
}

export interface LoginRequest {
  username: string;
  password: string;
}

export interface RegisterRequest {
  username: string;
  email: string;
  password: string;
  tenantId: number;
}

export interface AuthResponse {
  token: string;
  user: User;
}

export interface PaginatedResponse<T> {
  items: T[];
  total: number;
  page: number;
  page_size: number;
}

export interface ApiError {
  detail: string;
}

export interface LlmModel {
  id: number;
  modelId: string;
  name: string;
  provider: string;
  category: 'Chat' | 'Reasoning';
  endpoint: string;
  accessKey?: string;
  description?: string;
  isEnabled: boolean;
  createdAt: string;
  updatedAt?: string;
  tenantId: number;
  createdBy: {
    id: number;
    username: string;
    email: string;
  };
}

export interface LlmModelCreateRequest {
  modelId: string;
  name: string;
  provider: string;
  category: 'Chat' | 'Reasoning';
  endpoint: string;
  accessKey: string;
  description?: string;
  isEnabled?: boolean;
}

export interface LlmModelUpdateRequest {
  modelId?: string;
  name?: string;
  provider?: string;
  category?: 'Chat' | 'Reasoning';
  endpoint?: string;
  accessKey?: string;
  description?: string;
  isEnabled?: boolean;
}

// Note: Legacy VirtualExpert types have been removed. Use Agent-related types instead.
